﻿/*
 * Copyright © 2011 Nokia Corporation. All rights reserved.
 * Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation. 
 * Other product and company names mentioned herein may be trademarks
 * or trade names of their respective owners. 
 * See LICENSE.TXT for license information.
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure.StorageClient;

namespace IAPRepo_WebRole.Models
{
    public class IAPProduct : TableServiceEntity
    {
        public static string PARTITION_KEY = "0";

        public static string TABLE_NAME = "IAPProducts";
        public static string BLOB_CONTAINER_NAME = "iap-blobs"; // must be lowercase with no special characters

        public IAPProduct()
        {
            PartitionKey = PARTITION_KEY;

            // Create a timestamp that sorts the newest entries on top
            RowKey = (DateTime.MaxValue - DateTime.UtcNow).Ticks.ToString("d19") + Guid.NewGuid().ToString();
        }

        public String ApplicationId { get; set; }
        public string ProductId { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }

        public string DownloadableUri { get; set; }
        public string DownloadableBlobName { get; set; }
        public string ImageUri { get; set; }
        public string ImageBlobName { get; set; }

        public override string ToString()
        {
            return
                "[IAPProduct ApplicationId=" + this.ApplicationId + ", " +
                "ProductId=" + this.ProductId + ", " +
                "Title=" + this.Title + ", " +
                "DownloadableUri=" + this.DownloadableUri + ", " +
                "ImageUri=" + this.ImageUri + "]";
        }
    }
}
